<?php

namespace App\Criteria\Category;

use Prettus\Repository\Contracts\CriteriaInterface;
use Prettus\Repository\Contracts\RepositoryInterface;

/**
 * Class GetByCatIdCriteria.
 *
 * @package namespace App\Criteria\Category;
 */
class GetByCatIdCriteria implements CriteriaInterface
{
    protected $cat_id;

    public function __construct($cat_id) {
        $this->cat_id = $cat_id;
    }

    /**
     * Apply criteria in query repository
     *
     * @param string              $model
     * @param RepositoryInterface $repository
     *
     * @return mixed
     */
    public function apply($model, RepositoryInterface $repository)
    {
        return $model->where(['cat_id' => $this->cat_id]);
    }
}
